import numpy as np


def load(file_name):
    r = np.load(file_name + '.npz')
    weights = []
    for n in range(len(r)):
        var_name = 'arr_' + str(n)
        weights.append(r[var_name])
    return weights


def save(data, file_name):
    weight = []
    for d in data:
        if d is None:
            continue
        for x in d:
            if isinstance(x, np.ndarray):
                weight.append(x)
    np.savez(file_name + '.npz', *weight)
